home *** CD-ROM | disk | FTP | other *** search
- /*
- * Copyright 2005 - 2006 Yahoo! Inc. All rights reserved.
- */
- function nsIYahooDomBuilder(){
- try{
- this.gPrefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
- var doc = Components.classes["@mozilla.org/xul/xul-document;1"].createInstance(Components.interfaces.nsIDOMDocument);
- this.document = doc.implementation.createDocument(this.ns, "overlay", null);
- this.toolbarDoc = doc.implementation.createDocument(this.ns, "overlay", null);
- this.toolbarDoc.firstChild.setAttribute("id", "toolbar");
- var str = Components.classes["@mozilla.org/intl/stringbundle;1"].getService(Components.interfaces.nsIStringBundleService);
- this.strings = str.createBundle("chrome://ytoolbar/locale/ytoolbar.properties");
- this.bm2Usage = new Array();
- this.clear();
- } catch(e){
- }
- }
- nsIYahooDomBuilder.prototype = {
- document : null,
- toolbarDoc : null,
- ns : "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul",
- toolbar : null,
- menubar : null,
- toolar_context : null,
- page_context : null,
- removables : [],
- bookmarks : null,
- bm2Feed : null,
- bm2Usage : {},
- bm2Prefs : [],
- bm2FolderSave : null,
- bm2FFBMImportCrumb : null,
- strings : null,
- addNode : function(node, parent){
- var dom, popup;
- try{
- var toolbar = false;
- if(parent == null){
- parent = this.toolbar;
- toolbar = true;
- if(node.id == "yahoo-toolbar-cm"){
- parent = this.toolar_context;
- toolbar = false;
- }
- else if(node.id == "yahoo-toolbar-rmc_m"){
- parent = this.page_context;
- toolbar = false;
- }
- else if(node.id == "yahoo-toolbar-acs"){
- this.menubarExtra.appendChild(this.document.createElementNS(this.ns, "menuseparator"));
- return this.menubarExtra;
- }
- else{
- if(this.toolbar.lastChild.childNodes.length > 0){
- parent = this.toolbar.lastChild;
- }
- else if(node.type == node.SEPARATOR_TYPE
- || (this.toolbar.firstChild.lastChild && this.toolbar.firstChild.lastChild.nodeName == "toolbarseparator")){
- parent = this.toolbar.lastChild;
- }
- else {
- parent = this.toolbar.firstChild;
- }
- }
- }
- else if(parent == this.alerts){
- toolbar = true;
- }
- if(toolbar){
- dom = parent.ownerDocument.createElementNS(this.ns, "toolbarbutton");
- switch(node.type){
- case node.BUTTON_TYPE:
- break;
- case node.BUTTONMENU_TYPE:
- dom.setAttribute("type", "menu-button");
- popup = dom.appendChild(parent.ownerDocument.createElementNS(this.ns, "menupopup"));
- break;
- case node.MENU_TYPE:
- dom.setAttribute("type", "menu");
- popup = dom.appendChild(parent.ownerDocument.createElementNS(this.ns, "menupopup"));
- break;
- case node.MENUITEM_TYPE:
- break;
- case node.EDITBOX_TYPE:
- dom = this.buildSearchBox(node);
- break;
- case node.SEPARATOR_TYPE:
- dom = parent.ownerDocument.createElementNS(this.ns, "toolbarseparator");
- break;
- default:
- return null;
- }
- }
- else{
- dom = parent.ownerDocument.createElementNS(this.ns, "menuitem");
- switch(node.type){
- case node.MENUITEM_TYPE:
- case node.BUTTON_TYPE:
- break;
- case node.BUTTONMENU_TYPE:
- case node.MENU_TYPE:
- dom = parent.ownerDocument.createElementNS(this.ns, "menu");
- popup = dom.appendChild(parent.ownerDocument.createElementNS(this.ns, "menupopup"));
- break;
- case node.SEPARATOR_TYPE:
- dom = parent.ownerDocument.createElementNS(this.ns, "menuseparator");
- break;
- case node.EDITBOX_TYPE:
- return null;
- break;
- default:
- return null;
- }
- }
- var id = node.id;
- dom.setAttribute("id", id);
- dom.setAttribute("label", node.name);
- dom.setAttribute("yhash", node.hash);
- var hash;
- eval("hash = {"+ node.hash +"}")
- if(id == "yahoo-toolbar-boo2_m" && hash.bmfeed){
- this.bm2Feed = unescape(hash.bmfeed);
- if(hash.bmfoldersave){
- this.bm2FolderSave = unescape(hash.bmfoldersave);
- }
- else{
- }
- }
- if("yahoo-toolbar-boo_m/boo_m_6/boo_m_6_1" == id && hash.bmimport) {
- if(hash.bmimport) {
- this.bm2FFBMImportCrumb = unescape(hash.bmimport);
- }
- }
- if(node.type == node.BUTTON_TYPE || node.type == node.MENUITEM_TYPE || node.type == node.BUTTONMENU_TYPE){
- if(!dom.hasAttribute("oncommand")){
- dom.setAttribute("oncommand", "yahooButtonHandler(event);");
- dom.setAttribute("onclick", "if(event.button == 1) yahooButtonHandler(event);");
- }
- dom.setAttribute("yevent", node.func);
- dom.setAttribute("ytrack", node.funcTracking);
- dom.setAttribute("yfunc", node.funcNum);
- if(node.funcUrl != null && node.funcUrl != ""){
- dom.setAttribute('yurl', node.funcUrl);
- }
- }
- if(dom.ownerDocument.firstChild && dom.ownerDocument.firstChild.id == "toolbar"){
- dom.setAttribute("contextmenu", "yahoo-toolbar-context");
- }
- if(dom.ownerDocument.firstChild && dom.ownerDocument.firstChild.id == "toolbar" && node.funcNum == "1" && parent.parentNod && parent.parentNode.id != "yahoo-toolbar-boo2_m" ){
- parent.parentNode.setAttribute("id", "yahoo-toolbar-bookmarks-"+ (node.funcTracking || 1));
- }
- if(node.id == "yahoo-toolbar-rss" || node.id == "yahoo-toolbar-rss_m" || node.id == "yahoo-toolbar-RSS"
- || node.id == "menu_yahoo-toolbar-rss" || node.id == "menu_yahoo-toolbar-rss_m" || node.id == "menu_yahoo-toolbar-RSS"){
- dom.style.display = "none";
- }
- if(node.id == "yahoo-toolbar-cm-sio"){
- dom.setAttribute("type", "checkbox");
- }
- dom.setAttribute("class", "yahoo-button-showlabel");
- if(node.icon != null && node.icon != ""){
- dom.setAttribute("image", node.icon);
- if(dom.tagName == "menuitem"){
- dom.setAttribute("class", "menuitem-iconic");
- }
- else if(dom.tagName == "menu"){
- dom.setAttribute("class", "menu-iconic");
- }
- }
- else if(node.icon == null || node.icon == ""){
- dom.setAttribute("class", "yahoo-button-noimg");
- }
- if(node.styles.indexOf("NOTEXT") > -1){
- dom.className = "yahoo-button-notext";
- }
- if(node.styles.indexOf("ALWAYSHIDE") > -1){
- dom.setAttribute("hidden", true);
- }
- if(node.id != null && node.styles.indexOf("REMOVEONCLICK") > -1){
- this.removables[this.removables.length] = dom;
- }
- dom.setAttribute("ystyles", node.styles);
- if(dom.ownerDocument.firstChild && dom.ownerDocument.firstChild.id == "toolbar" && node.type != node.EDITBOX_TYPE && node.styles.indexOf("NOTOOLTIP") == -1){
- dom.setAttribute("tooltiptext", node.name);
- if(hash.at != null){
- var tt = "";
- var tooltip = hash.at;
- if(tooltip){
- tooltip = tooltip.replace(/%25/g, "");
- tooltip = tooltip.replace(/%|\$|,/g, "");
- dom.setAttribute("tooltiptext", tooltip);
- }
- }
- }
- parent.appendChild(dom);
- if(dom.ownerDocument.firstChild && dom.ownerDocument.firstChild.id == "toolbar"){
- var mdom, mpopup;
- if(dom.nodeName.indexOf("toolbar") == 0){
- switch(dom.nodeName){
- case "toolbarbutton":
- switch(dom.getAttribute("type")){
- case "menu-button":
- mdom = this.document.createElementNS(this.ns, "menu");
- mpopup = mdom.appendChild(this.document.createElementNS(this.ns, "menupopup"));
- mdom.setAttribute("label", node.name);
- if(node.id != null){
- mdom.setAttribute("id", "menu_"+ node.id);
- }
- mdom = mpopup.appendChild(this.document.createElementNS(this.ns, "menuitem"));
- mpopup.appendChild(this.document.createElementNS(this.ns, "menuseparator"));
- break;
- case "menu":
- mdom = this.document.createElementNS(this.ns, "menu");
- mpopup = mdom.appendChild(this.document.createElementNS(this.ns, "menupopup"));
- break;
- default:
- mdom = this.document.createElementNS(this.ns, "menuitem");
- }
- break;
- case "toolbarseparator":
- mdom = this.document.createElementNS(this.ns, "menuseparator");
- break;
- }
- if(mdom){
- var attr;
- for(var i = 0; i < dom.attributes.length; i++){
- attr = dom.attributes[i];
- if( attr.name != "id"
- && attr.name != "contextmenu"
- && attr.name != "class"
- && attr.name != "image"
- && attr.name != "tooltiptext"
- && attr.name != "type"){
- mdom.setAttribute(attr.name, attr.value);
- }
- }
- }
- }
- else{
- mdom = dom.cloneNode(true);
- if(popup){
- mpopup = mdom.firstChild;
- }
- }
- if(mdom != null){
- if(node.id != null){
- if(node.type == node.BUTTONMENU_TYPE){
- mdom.setAttribute("id", "menu_"+ node.id +"_btn");
- }
- else{
- mdom.setAttribute("id", "menu_"+ node.id);
- }
- }
- mdom.removeAttribute("class");
- mdom.removeAttribute("contextmenu");
- mdom.removeAttribute("tooltiptext");
- mdom.setAttribute("class", "menuitem-iconic");
- mdom.style.display = dom.style.display;
- if(node.type == node.BUTTONMENU_TYPE){
- mdom = mpopup.parentNode;
- }
- if(node.id != null && node.styles.indexOf("REMOVEONCLICK") > -1){
- this.removables[this.removables.length] = dom;
- }
- if(node.parentNode && node.parentNode.domMenubar){
- node.parentNode.domMenubar.appendChild(mdom);
- }
- else{
- this.menubar.appendChild(mdom);
- }
- node.domMenubar = mpopup || mdom;
- }
- }
- } catch(e){
- }
- if(popup != null){
- dom = popup;
- }
- mdom = null;
- mpopup = null;
- popup = null;
- node = null;
- return dom;
- },
- buildSearchBox : function(node){
- var dom = null;
- try{
- dom = this.toolbarDoc.createElementNS(this.ns, "toolbaritem");
- var search = this.toolbarDoc.createElementNS(this.ns, "textbox");
- search.setAttribute("id", "yahooToolbarEditBox");
- search.setAttribute("flex", "1");
- search.setAttribute("size", "4");
- search.setAttribute("minwidth", "55");
- search.setAttribute("sizetopopup", "false");
- search.setAttribute("yevent", node.func);
- search.setAttribute("ytrack", node.funcTracking);
- search.setAttribute("yfunc", node.funcNum);
- search.setAttribute('onkeyup', "if(event.keyCode == event.DOM_VK_ENTER || event.keyCode == event.DOM_VK_RETURN){ this.blurred(event, true); yahooButtonHandler(event); }");
- if(Components.interfaces.nsIXULAppInfo){
- var app = Components.classes["@mozilla.org/xre/app-info;1"].getService(Components.interfaces.nsIXULAppInfo);
- if(app && parseFloat(app.version) >= 1.5){
- search.setAttribute("class", "yahoo-toolbar-search-live");
- search.setAttribute("autocompletepopup", "yahooToolbarEditBox-history");
- search.setAttribute("enablehistory", "true");
- search.setAttribute('onkeyup', "yahooUpdateSearchHistory(this, null, event);");
- var searchHash;
- eval("searchHash = { "+ node.hash +"}");
- if(searchHash.live){
- this.gPrefs.setBoolPref("yahoo.supports.livesearch", true);
- search.setAttribute("ylive", unescape(searchHash.live));
- }
- else{
- this.gPrefs.setBoolPref("yahoo.supports.livesearch", false);
- search.setAttribute("ylive", "");
- }
- }
- }
- search.yselect = true;
- search.setAttribute("onmousedown", "this.yselect = !this.hasAttribute('focused')");
- search.setAttribute("onclick", "if(this.yselect){ this.select(); }");
- var splitter = this.toolbarDoc.createElementNS(this.ns, "splitter");
- splitter.id = "yahoo-toolbar-splitter";
- splitter.setAttribute("resizebefore", "grow");
- splitter.setAttribute("resizeafter", "grow");
- splitter.setAttribute("onmouseup", "yahooSplitterResize()");
- splitter.setAttribute("onclick", "yahooSetSearchboxSize()");
- var hbox = this.toolbarDoc.createElementNS(this.ns, "hbox");
- hbox.setAttribute("flex", "1");
- dom.appendChild(search);
- dom.appendChild(splitter);
- dom.appendChild(hbox);
- } catch(e){
- }
- return dom;
- },
- clear : function(){
- try{
- this.removables = [];
- this.toolbar = null;
- this.menubar = null;
- this.menubarExtra = null;
- this.toolar_context = null;
- this.page_context = null;
- this.alerts = null;
- this.toolbar = this.toolbarDoc.createDocumentFragment();
- this.menubar = this.document.createDocumentFragment();
- this.menubarExtra = this.document.createDocumentFragment();
- this.toolar_context = this.document.createDocumentFragment();
- this.page_context = this.document.createDocumentFragment();
- this.alerts = this.document.createDocumentFragment();
- this.toolbar.appendChild(this.toolbarDoc.createElementNS(this.ns, "hbox"));
- this.toolbar.appendChild(this.toolbarDoc.createElementNS(this.ns, "hbox"));
- this.toolbar.firstChild.id = "yahoo-toolbar-reqbtns";
- this.toolbar.lastChild.id = "yahoo-toolbar-btns";
- } catch(e){
- }
- },
- remove : function(id){
- try{
- var nId;
- for(var i = 0; i < this.removables.length; i++){
- if(this.removables[i] != null && this.removables[i].parentNode != null
- && (this.removables[i].id == id || this.removables[i].id == "menu_"+ id || this.removables[i].id == "menu_"+ id +"_btn")){
- this.removables[i].parentNode.removeChild(this.removables[i]);
- this.removables[i] = null;
- }
- }
- } catch(e){
- }
- },
- clearBM2 : function(){
- try{
- this.bookmarks = null;
- this.bookmarks = this.document.createDocumentFragment();
- } catch(e){
- }
- },
- buildBM2 : function(dom, parent){
- try{
- if(!parent){
- parent = this.bookmarks;
- }
- var uni = Components.classes["@mozilla.org/intl/scriptableunicodeconverter"].createInstance(Components.interfaces.nsIScriptableUnicodeConverter);
- uni.charset = "utf-8";
- var node, name, type, url, menu, menupopup, menuitem, str;
- for(var i = 0; i < dom.childNodes.length; i++){
- node = dom.childNodes[i];
- if(node.nodeName != "outline"){
- continue;
- }
- type = node.getAttribute("type");
- url = node.getAttribute("u");
- name = uni.ConvertToUnicode(node.getAttribute("text"));
- switch(type){
- case "F":
- if(node.getAttribute("text") == "root" && node.parentNode && node.parentNode.getAttribute("type") == "ResultSet"){
- this.buildBM2(node, parent);
- }
- else if(node.getAttribute("text") == "tags" && this.bm2Prefs.DisplayFoldersAs == "TagView" && node.getAttribute("fid") == "-1"){
- this.buildBM2(node, parent);
- }
- else{
- menu = this.document.createElementNS(this.ns, "menu");
- menu.setAttribute("crop", "end");
- menu.setAttribute("label", name);
- menu.setAttribute("tooltiptext", name);
- menu.setAttribute("onclick", "if(event.button == 1) {yahooBookmarksOpenAll(this.firstChild); yahooButtonHandler(event);}");
- menupopup = this.document.createElementNS(this.ns, "menupopup");
- if(this.bm2FolderSave){
- str = this.getStr("yahoo.bookmarks.folder.add", "Add page to '__TITLE__'").replace("__TITLE__", name);
- menuitem = this.document.createElementNS(this.ns, "menuitem");
- menuitem.setAttribute("crop", "end");
- menuitem.setAttribute("label", str);
- menuitem.setAttribute("tooltiptext", str);
- menupopup.appendChild(menuitem);
- menupopup.appendChild(this.document.createElementNS(this.ns, "menuseparator"));
- var func = this.bm2FolderSave;
- menuitem.setAttribute("yevent", this.bm2FolderSave.replace("__FOLDERID__", node.getAttribute("fid")) );
- menuitem.setAttribute("oncommand", "yahooButtonHandler(event);");
- }
- this.buildBM2(node, menupopup);
- str = this.getStr("yahoo.bookmarks.folder.open", "Open in Tabs").replace("__TITLE__", name);
- menupopup.appendChild(this.document.createElementNS(this.ns, "menuseparator"));
- menuitem = this.document.createElementNS(this.ns, "menuitem");
- menuitem.setAttribute("crop", "end");
- menuitem.setAttribute("label", str);
- menuitem.setAttribute("tooltiptext", str);
- menuitem.setAttribute("oncommand", "yahooBookmarksOpenAll(this.parentNode);");
- menuitem.setAttribute("onclick", "if(event.button == 1) yahooButtonHandler(event);");
- menupopup.appendChild(menuitem);
- menu.appendChild(menupopup);
- parent.appendChild(menu);
- }
- break;
- case "B":
- if((node.parentNode.getAttribute("type") == "RecentSave" || node.parentNode.getAttribute("type") == "FrequentUse")
- && ( (node.parentNode.getAttribute("type") == this.bm2Prefs.OrderBy && parent.childNodes.length - 1 == this.bm2Prefs.ToolbarDisplay)
- || parent.childNodes.length == this.bm2Prefs.ToolbarDisplay)){
- break;
- }
- menuitem = this.document.createElementNS(this.ns, "menuitem");
- menuitem.setAttribute("crop", "end");
- menuitem.setAttribute("label", name);
- menuitem.setAttribute("value", node.getAttribute("u"));
- menuitem.setAttribute("contextmenu", "yahoo-toolbar-context");
- menuitem.setAttribute("tooltiptext", name);
- menuitem.setAttribute("maxwidth", "300px");
- url = url.replace(/,/g, "%2C");
- menuitem.setAttribute("yevent", ",4,boo_m,%"+ url);
- menuitem.setAttribute("ytrack", "boo_m");
- menuitem.setAttribute("yfunc", "4");
- menuitem.setAttribute('yurl', url);
- menuitem.setAttribute('ybid', node.getAttribute("bid"));
- menuitem.setAttribute("oncommand", "yahooButtonHandler(event);");
- menuitem.setAttribute("onclick", "if(event.button == 1) yahooButtonHandler(event);");
- parent.appendChild(menuitem);
- break;
- case "Toolbar":
- var d;
- for(var n = 0; n < node.childNodes.length; n++){
- d = node.childNodes[n];
- if(d.nodeName == "outline" && d.getAttribute("type") == "Pref"){
- this.bm2Prefs[d.getAttribute("text")] = d.getAttribute("a");
- }
- }
- break;
- case "RecentSave":
- if(this.bm2Prefs.ToolbarDisplay == 0 || node.getAttribute("total") == "0"){
- break;
- }
- if(this.bm2Prefs.OrderBy == "RecentlySaved"){
- var frag = this.document.createDocumentFragment()
- frag.appendChild(this.document.createElementNS(this.ns, "menuitem"));
- frag.lastChild.setAttribute("label", this.getStr("yahoo.bookmarks.quick.recent", "Recently Saved"));
- frag.lastChild.setAttribute("tooltiptext", this.getStr("yahoo.bookmarks.quick.recent", "Recently Saved"));
- frag.lastChild.style.fontWeight = "bold";
- this.buildBM2(node, frag);
- var sep = this.document.createElementNS(this.ns, "menuseparator");
- sep.setAttribute("id", "yahoo-bookmarks-quickaccess-separator");
- if(parent.qaFolder){
- parent.insertBefore(frag, parent.qaFolder);
- parent.insertBefore(sep, parent.qaFolder);
- parent.qaFolder = null;
- }
- else{
- parent.appendChild(frag);
- parent.appendChild(sep);
- }
- }
- else{
- menu = this.document.createElementNS(this.ns, "menu");
- menu.setAttribute("id", "yahoo-bookmarks-quickaccess-folder");
- menu.setAttribute("label", this.getStr("yahoo.bookmarks.quick.recent", "Recently Saved"));
- menu.setAttribute("tooltiptext", this.getStr("yahoo.bookmarks.quick.recent", "Recently Saved"));
- menupopup = this.document.createElementNS(this.ns, "menupopup");
- this.buildBM2(node, menupopup);
- menu.appendChild(menupopup);
- parent.appendChild(menu);
- parent.qaFolder = menu;
- }
- break;
- case "FrequentUse":
- if(this.bm2Prefs.ToolbarDisplay == 0 || node.getAttribute("total") == "0"){
- break;
- }
- if(this.bm2Prefs.OrderBy == "FrequentlyAccessed"){
- var frag = this.document.createDocumentFragment()
- frag.appendChild(this.document.createElementNS(this.ns, "menuitem"));
- frag.lastChild.setAttribute("label", this.getStr("yahoo.bookmarks.quick.frequent", "Frequently Used"));
- frag.lastChild.setAttribute("tooltiptext", this.getStr("yahoo.bookmarks.quick.frequent", "Frequently Used"));
- frag.lastChild.style.fontWeight = "bold";
- this.buildBM2(node, frag);
- var sep = this.document.createElementNS(this.ns, "menuseparator");
- sep.setAttribute("id", "yahoo-bookmarks-quickaccess-separator");
- if(parent.qaFolder){
- parent.insertBefore(frag, parent.qaFolder);
- parent.insertBefore(sep, parent.qaFolder);
- parent.qaFolder = null;
- }
- else{
- parent.appendChild(frag);
- parent.appendChild(sep);
- }
- }
- else{
- menu = this.document.createElementNS(this.ns, "menu");
- menu.setAttribute("id", "yahoo-bookmarks-quickaccess-folder");
- menu.setAttribute("label", this.getStr("yahoo.bookmarks.quick.frequent", "Frequently Used"));
- menu.setAttribute("tooltiptext", this.getStr("yahoo.bookmarks.quick.frequent", "Frequently Used"));
- menupopup = this.document.createElementNS(this.ns, "menupopup");
- this.buildBM2(node, menupopup);
- menu.appendChild(menupopup);
- parent.appendChild(menu);
- parent.qaFolder = menu;
- }
- break;
- }
- }
- uni = null;
- } catch(e){
- }
- },
- bumpUpBM2Usage : function(bid) {
- if(null == bid || "" == bid)
- return;
- var cnt = 1;
- if(null != this.bm2Usage[bid])
- {
- cnt = parseInt(this.bm2Usage[bid]);
- cnt = (cnt < 1 ? 0 : cnt) + 1;
- }
- this.bm2Usage[bid] = "" + cnt;
- },
- getBM2UsageString : function() {
- var str = "";
- for(key in this.bm2Usage) {
- if(null != key && "" != key) {
- str += (str.length < 1 ? "" : ",")
- + key + "|" + this.bm2Usage[key];
- }
- }
- return str;
- },
- clearBM2Usage : function() {
- for(key in this.bm2Usage) {
- this.bm2Usage[key] = null;
- }
- this.bm2Usage = new Array();
- },
- getStr : function(name, def){
- var str = null;
- if(this.strings){
- str = this.strings.GetStringFromName(name);
- }
- if(!str && def){
- return def;
- }
- return str;
- },
- debug : function(msg){
- if(typeof(Components.interfaces.nsIDebugLoggerManager) != 'undefined'){
- logMngr = Components.classes["@mozmonkey.com/debuglogger/manager;1"].getService(Components.interfaces.nsIDebugLoggerManager);
- logger = logMngr.registerLogger("yfeedtest");
- logger.log(3, msg);
- }
- },
- QueryInterface: function (iid) {
- if(!iid.equals(Components.interfaces.nsIYahooDomBuilder) && !iid.equals(Components.interfaces.nsISupports))
- throw Components.results.NS_ERROR_NO_INTERFACE;
- return this;
- }
- };
- function NSGetModule(compMgr, fileSpec) {
- return {
- myCID : Components.ID("{15e84d13-9bda-4810-ad02-437d2580c87d}"),
- myProgID : "@yahoo.com/dombuilder;1",
- firstTime : true,
- registerSelf : function (compMgr, fileSpec, location, type) {
- if (this.firstTime) {
- this.firstTime = false;
- throw Components.results.NS_ERROR_FACTORY_REGISTER_AGAIN;
- }
- compMgr = compMgr.QueryInterface(Components.interfaces.nsIComponentRegistrar);
- compMgr.registerFactoryLocation(this.myCID, "Yahoo! Dom Builder", this.myProgID, fileSpec, location, type);
- },
- getClassObject : function (compMgr, cid, iid) {
- if (!cid.equals(this.myCID)) throw Components.results.NS_ERROR_NO_INTERFACE;
- if (!iid.equals(Components.interfaces.nsIFactory)) throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
- return this.myFactory;
- },
- myFactory : {
- createInstance : function (outer, iid) {
- if (outer != null) throw Components.results.NS_ERROR_NO_AGGREGATION;
- return (new nsIYahooDomBuilder()).QueryInterface(iid);
- }
- },
- canUnload : function(compMgr) { return true; }
- };
- }
-